<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String adminUserId = (String) session.getAttribute("adminUserId");
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>

<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">
</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">


					<div class="clearfix"></div>



					<br />




				</div>
			</div>



			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="clearfix"></div>

					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="x_panel">
								<div class="x_title">
									<h2>修改密码</h2>

									<div class="clearfix"></div>
								</div>
								<div class="x_content">

									<form class="form-horizontal form-label-left" novalidate>

										<p>
											您正在操作
											<code>修改密码</code>
											请谨慎修改
										</p>





										<div class="item form-group">
											<label for="password" class="control-label col-md-3">新密码</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="password" type="password" name="password"
													data-validate-length="6,8"
													class="form-control col-md-7 col-xs-12" required="required">
											</div>
										</div>
										<div class="item form-group">
											<label for="password2"
												class="control-label col-md-3 col-sm-3 col-xs-12">确认密码
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="passwordre" type="password" name="password2"
													data-validate-linked="password"
													class="form-control col-md-7 col-xs-12" required="required">
											</div>
										</div>


										<div class="ln_solid"></div>
										<div class="form-group">
											<div class="col-md-6 col-md-offset-3">
												<a type="submit" class="btn btn-primary"
													href="javascript:void(0)"
													onclick="history.back(-1);">取消</a> <a id="send"
													type="submit" class="btn btn-success"
													href="javascript:void(0)"
													onclick=" ajaxPost(' ${adminUserId}')">修改</a>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- /page content -->
			<script type="text/javascript">
				// ajax 对象
				function ajaxObject() {
					var xmlHttp;
					try {
						// Firefox, Opera 8.0+, Safari
						xmlHttp = new XMLHttpRequest();
					} catch (e) {
						// Internet Explorer
						try {
							xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try {
								xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e) {
								alert("您的浏览器不支持AJAX！");
								return false;
							}
						}
					}
					return xmlHttp;
				}
			
				// ajax post请求：
				function ajaxPost(id) {
					var password = $("#password").val();
					var passwordre = $("#passwordre").val();
					var choose = 3;
					if (password == passwordre) {
						var ajax = ajaxObject();
						ajax.open("post", "updateUsers?password=" + password +
							"&id=" + id +
							"&choose=" + choose, true);
						ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
						ajax.onreadystatechange = function() {
							if (ajax.readyState == 4) {
								if (ajax.status == 200) {
									var result = ajax.responseText;
									if (result == "success") {
										//请求成功
										alert("密码修改成功");
										top.location.href="login/${titleId }";
									} else {
										//请求成功
										alert(result);
									}
								} else {
									//请求失败
									alert("请求终止，请检查操作或联系客服咨询" + ajax.status);
								}
							} else {
							}
						};
						ajax.send();
					} else {
						alert("两次输入的密码不一致");
					}
				}
			</script>

		</div>
	</div>


	<!-- jQuery -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>
	<!-- validator -->
	<script src="<%=basePath%>vendors/validator/validator.js"></script>
	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
	<!-- validator -->
	<script src="<%=basePath%>vendors/validator/validator.js"></script>
</body>
</html>